<template>
  <div id="app">
    <button @click="isShow = 'child1' ">显示组件1</button>
    <button @click="isShow = 'child2' ">显示组件2</button>
    <button @click="isShow = 'child3' ">显示组件3</button>

    <component :is='isShow'></component>
    <!-- <child1 v-if="isShow == 1"></child1>
    <child2 v-if="isShow == 2"></child2>
    <child3 v-if="isShow == 3"></child3> -->
  </div>
</template>

<script>
import child1 from './child1'
import child2 from './child2'
import child3 from './child3'
export default {
  components: { 
    child1,
    child2,
    child3
     },
     data() {
       return {
         isShow:'child1'
       }
     },
  
}
</script>
<style lang="scss">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
